﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;

namespace SemestralniPraceY35VAN
{
    class Settings
    {
        /// <summary>
        /// Properties of the setting.
        /// </summary>
        private Hashtable properties;

        /// <summary>
        /// 
        /// </summary>
        public string Pings { get { if (properties.ContainsKey("pings")) return (string)properties["pings"]; else return null; } }

        /// <summary>
        /// 
        /// </summary>
        public string SendToTwitter { get { if (properties.ContainsKey("sendtotwitter")) return (string)properties["sendtotwitter"]; else return null; } }

        /// <summary>
        /// 
        /// </summary>
        public string SendToFacebook { get { if (properties.ContainsKey("sendtofacebook")) return (string)properties["sendtofacebook"]; else return null; } }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="setting"></param>
        public Settings(XmlNode settings)
        {
            properties = new Hashtable();

            if (settings.Name == "settings")
            {
                for (int i = 0; i < settings.ChildNodes.Count; i++)
                {
                    properties.Add(settings.ChildNodes[i].Name, settings.ChildNodes[i].InnerText);
                }
            }
            else
            {
                throw new IOException("Not Settings!");
            }
        }
    }
}
